package com.example.edu.Controller;

import com.example.edu.Dto.Return;
import com.example.edu.Entity.User;
import com.example.edu.Service.UserService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/user")
public class UserController {
    @Resource
    UserService userService;

    @PostMapping("/update")
    public Return update(HttpServletRequest request, @RequestBody User new_message){
        return userService.update(request,new_message);
    }

    @PostMapping("updatePassword")
    public Return updatePassword(HttpServletRequest request, @RequestBody User new_message){
        return userService.updatePassword(request,new_message);
    }

    @PostMapping("/get")
    public Return get(HttpServletRequest request){
        return userService.get(request);
    }

    @PostMapping("/logout")
    public Return logout(HttpServletRequest request){
        return userService.logout(request);
    }
}
